package spring.cloud.tasks.tasks_manager.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import spring.cloud.tasks.tasks_manager.dto.NamespaceDto;
import spring.cloud.tasks.tasks_manager.dto.ZooKeeperDto;
import spring.cloud.tasks.tasks_manager.mapper.NameSpaceDtoMapper;
import spring.cloud.tasks.tasks_manager.mapper.ZooKeeperDtoMapper;
import spring.cloud.tasks.tasks_manager.service.NamespaceDtoService;

@Service
public class NamespaceDtoServiceImpl implements NamespaceDtoService {
    @Autowired
    private ZooKeeperDtoMapper zooKeeperDtoMapper;

    @Autowired
    private NameSpaceDtoMapper nameSpaceDtoMapper;

    @Override
    public NamespaceDto getNamespaceDto(String namespaceKey) {
        //
        NamespaceDto namespaceDto = nameSpaceDtoMapper.selectByNamespaceKey(namespaceKey);
        ZooKeeperDto zooKeeperDto = zooKeeperDtoMapper.selectByZooKeeperKey(namespaceDto.getZookeeperKey());
        return namespaceDto;
    }
}
